package homework04.test01;

public class WorkerTest {

    public static void main(String[] args) {

        try {
            // 声明Worker类, 姓名为Null, 测试空异常
            Worker worker1 = new Worker(null, 20);
        } catch (AgeException | EmptyException e) {
            System.out.println(e.getMessage());
        }

        try {
            //声明Worker类, 年龄为0, 测试年龄异常
            Worker worker2 = new Worker("张飞", 0);
        } catch (AgeException | EmptyException e) {
            System.out.println(e.getMessage());
        }

        Worker worker3 = null;
        try {
            /**
             * 正常new一个worker对象然后打印
             */
            worker3 = new Worker("关羽", 35);
            System.out.println(worker3);
        } catch (AgeException e) {
            e.printStackTrace();
        } catch (EmptyException e) {
            e.printStackTrace();
        }

    }
}
